package com.zhr.tea.view.fragment;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.zhr.tea.R;
import com.zhr.tea.utils.IsLogin;
import com.zhr.tea.view.activity.RegestActivity;
import com.zhr.tea.view.activity.DingdanActivity;
import com.zhr.tea.view.activity.PingjiaActivity;
import com.zhr.tea.view.activity.XiaoguotuActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * A simple {@link Fragment} subclass.
 */
public class MyFragment extends Fragment {


    @BindView(R.id.my_btn_login)
    Button myBtnLogin;
    @BindView(R.id.my_iv_head)
    ImageView myIvHead;
    @BindView(R.id.my_tv_name)
    TextView myTvName;
    @BindView(R.id.my_login_after)
    RelativeLayout myLoginAfter;
    @BindView(R.id.my_iv_setting)
    ImageView myIvSetting;
    @BindView(R.id.my_iv_xiaoxi)
    ImageView myIvXiaoxi;
    @BindView(R.id.my_btn_pay)
    TextView myBtnPay;
    @BindView(R.id.my_btn_send)
    TextView myBtnSend;
    @BindView(R.id.my_btn_accept)
    TextView myBtnAccept;
    @BindView(R.id.my_btn_pingjia)
    TextView myBtnPingjia;
    @BindView(R.id.my_btn_xiaoguotu)
    TextView myBtnXiaoguotu;
    @BindView(R.id.my_btn_youhuijuan)
    TextView myBtnYouhuijuan;
    @BindView(R.id.my_btn_qianbao)
    TextView myBtnQianbao;
    @BindView(R.id.my_btn_zhongchou)
    TextView myBtnZhongchou;
    @BindView(R.id.my_btn_dizhi)
    TextView myBtnDizhi;
    @BindView(R.id.my_btn_teagift)
    TextView myBtnTeagift;
    @BindView(R.id.my_btn_zuopin)
    TextView myBtnZuopin;
    @BindView(R.id.my_btn_collection)
    TextView myBtnCollection;
    @BindView(R.id.my_btn_kefu)
    TextView myBtnKefu;
    @BindView(R.id.my_btn_kefudianhua)
    LinearLayout myBtnKefudianhua;

    public MyFragment() {
        // Required empty public constructor
    }

    public static MyFragment newInstance() {

        Bundle args = new Bundle();

        MyFragment fragment = new MyFragment();
        fragment.setArguments(args);
        return fragment;
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_my, container, false);
        initView(view);
        return view;
    }

    private void initView(View view) {
        ButterKnife.bind(this, view);
    }

    @Override
    public void onResume() {
        super.onResume();
        if (IsLogin.isLogin) {
            myBtnLogin.setVisibility(View.GONE);
            myLoginAfter.setVisibility(View.VISIBLE);
        } else {
            myBtnLogin.setVisibility(View.VISIBLE);
            myLoginAfter.setVisibility(View.GONE);
        }
    }

    private Intent intent;

    @OnClick({R.id.my_btn_login, R.id.my_iv_head, R.id.my_tv_name, R.id.my_login_after, R.id.my_iv_setting, R.id.my_iv_xiaoxi, R.id.my_btn_pay, R.id.my_btn_send, R.id.my_btn_accept, R.id.my_btn_pingjia, R.id.my_btn_xiaoguotu, R.id.my_btn_youhuijuan, R.id.my_btn_qianbao, R.id.my_btn_zhongchou, R.id.my_btn_dizhi, R.id.my_btn_teagift, R.id.my_btn_zuopin, R.id.my_btn_collection, R.id.my_btn_kefu, R.id.my_btn_kefudianhua})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.my_btn_login:
                startActivity(new Intent(getActivity(), RegestActivity.class));
                break;
            case R.id.my_iv_head:
                break;
            case R.id.my_tv_name:
                break;
            case R.id.my_login_after:
                break;
            case R.id.my_iv_setting:
                break;
            case R.id.my_iv_xiaoxi:
                break;
            case R.id.my_btn_pay:
                intent = new Intent(getActivity(), DingdanActivity.class);
                intent.putExtra("num", 1);
                startActivity(intent);
                break;
            case R.id.my_btn_send:
                intent = new Intent(getContext(), DingdanActivity.class);
                intent.putExtra("num", 2);
                startActivity(intent);
                break;
            case R.id.my_btn_accept:
                intent = new Intent(getContext(), DingdanActivity.class);
                intent.putExtra("num", 3);
                startActivity(intent);
                break;
            case R.id.my_btn_pingjia:
                intent = new Intent(getContext(), PingjiaActivity.class);
                startActivity(intent);
                break;
            case R.id.my_btn_xiaoguotu:
                intent = new Intent(getContext(), XiaoguotuActivity.class);
                startActivity(intent);
                break;
            case R.id.my_btn_youhuijuan:
                break;
            case R.id.my_btn_qianbao:
                break;
            case R.id.my_btn_zhongchou:
                break;
            case R.id.my_btn_dizhi:
                break;
            case R.id.my_btn_teagift:
                break;
            case R.id.my_btn_zuopin:
                break;
            case R.id.my_btn_collection:
                break;
            case R.id.my_btn_kefu:
                break;
            case R.id.my_btn_kefudianhua:
                break;
        }
    }

}
